package com.android.widget.horizontalscrollview;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.android.widget.demo.R;

import android.app.Activity;
import android.os.Bundle;

public class HorizontalScrollViewDemo extends Activity {
    private HorizontalScrollViewWidget mScrollView;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_horizontal_scroll_view);
    
        mScrollView=(HorizontalScrollViewWidget)findViewById(R.id.scroll_view);
       
        List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
        //this adapter is based BaseAdapter
        HorizontalScrollViewAdapter2 adapter2 = new HorizontalScrollViewAdapter2(this);
        for(int i=0;i<10;i++){
            Map<String,Object> map=new HashMap<String,Object>();
            map.put("image", getResources().getDrawable(R.drawable.ic_launcher));
            map.put("text", "GGGGGGG"+(i+1));
            dataList.add(map);
//            adapter2.addData(map);
        } 
        adapter2.setData(dataList);
        mScrollView.setAdapter(adapter2);
        
        /*
        //based ArrayAdapter
        HorizontalScrollViewAdapter adapter = new HorizontalScrollViewAdapter(this,0,dataList);
        mScrollView.setAdapter(adapter);
        */
    }   

}
